package com.java2207.group1.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.java2207.group1.bo.HospitalizedBo;
import com.java2207.group1.pojo.Hospitalized;
import com.java2207.group1.service.HospitalizedService;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * 15319 2022/7/27 19:28
 */

@Component
@Scope("prototype")
public class WebHospitalizedListener extends AnalysisEventListener<HospitalizedBo> {
    private HospitalizedService hospitalizedService;


    @Override
    public void invoke(HospitalizedBo hospitalizedBo, AnalysisContext analysisContext) {
        Hospitalized hospitalized = new Hospitalized();
        BeanUtils.copyProperties(hospitalizedBo,hospitalized);
        hospitalizedService.hospitalizedAdd(hospitalized);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
